package com.EE7th.dto;

import com.EE7th.domain.Clazz;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;

@Data
public class ClazzDTO {
    //classID
    private Integer clazzId;

    //className
    private String clazzName;

    //grade
    private String grade;

    // 教师id
    private Integer teacherId;

    //教师名
    private String teacherName;

    //创建时间
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    public ClazzDTO(Clazz clazz, TeacherDTO teacherDTO) {
        this.clazzId = clazz.getClazzId();
        this.clazzName = clazz.getClazzName();
        this.grade = clazz.getGrade();
        this.teacherId = teacherDTO.getTeacherId();
        this.teacherName = teacherDTO.getName();
        this.createTime = clazz.getCreateTime();
    }

    public ClazzDTO(Clazz clazz, Integer teacherId, String teacherName) {
        this.clazzId = clazz.getClazzId();
        this.clazzName = clazz.getClazzName();
        this.grade = clazz.getGrade();
        this.teacherId = teacherId;
        this.teacherName = teacherName;
        this.createTime = clazz.getCreateTime();
    }
}